﻿Public Class FrmBatch

    Dim Cancelled As Boolean
    Dim Processing As Boolean

    Private Sub Process()
		'Processing = True
		'Dim Photos = (From p In Studio.Files.Values Where TypeOf p Is Photo).ToList
		'ProgressBar1.Value = 0
		'ProgressBar1.Maximum = Photos.Count
		'For Each Photo As Photo In Photos
		'    Dim B As New Bitmap(MainFolder & Photo.Title)
		'    If ChkDateTaken.Checked And Len(Photo.DateTaken) < 5 Then Photo.DateTaken = Studio.GetDatePhotoTaken(B)
		'    If ChkSize.Checked And Photo.Size = "" Then Photo.Size = Studio.GetPhotoSize(B)
		'    B.Dispose()
		'    ProgressBar1.Increment(1)
		'    Application.DoEvents()
		'    If Cancelled Then
		'        ProgressBar1.Value = 0
		'        Exit For
		'    End If
		'Next
		'Studio.Save()
		'Close()
    End Sub

    Private Sub BtnOK_Click(sender As System.Object, e As System.EventArgs) Handles BtnOK.Click
        BtnCancel.Text = "Durdur"
        BtnOK.Enabled = False
        Application.DoEvents()
        Process()
    End Sub

    Private Sub BtnCancel_Click(sender As System.Object, e As System.EventArgs) Handles BtnCancel.Click
        If Processing Then Cancelled = True Else Close()
    End Sub
End Class